home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-03-25 | 9.9 KB | 481 lines | [TEXT/MPS ] |
- /*•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
- /* Sample.r
- /*
- /* Modified for Virtual Sphere Sample Code Release v1.1
- /*
- /* Author: Michael Chen, Human Interface Group / ATG
- /* Copyright © 1991-1993 Apple Computer, Inc. All rights reserved.
- /*•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••*/
- /*------------------------------------------------------------------------------
- #
- # Apple Macintosh Developer Technical Support
- #
- # MultiFinder-Aware Simple Sample Application
- #
- # Sample
- #
- # Sample.r - Rez Source
- #
- # Copyright © Apple Computer, Inc. 1989-1990
- # All rights reserved.
- #
- # Versions:
- # 1.00 08/88
- # 1.01 11/88
- # 1.02 04/89 MPW 3.1
- # 1.03 02/90 MPW 3.2
- #
- # Components:
- # Sample.c Feb. 1, 1990
- # Sample.r Feb. 1, 1990
- # Sample.h Feb. 1, 1990
- # Sample.make Feb. 1, 1990
- #
- # Sample is an example application that demonstrates how to
- # initialize the commonly used toolbox managers, operate
- # successfully under MultiFinder, handle desk accessories,
- # and create, grow, and zoom windows.
- #
- # It does not by any means demonstrate all the techniques
- # you need for a large application. In particular, Sample
- # does not cover exception handling, multiple windows/documents,
- # sophisticated memory management, printing, or undo. All of
- # these are vital parts of a normal full-sized application.
- #
- # This application is an example of the form of a Macintosh
- # application; it is NOT a template. It is NOT intended to be
- # used as a foundation for the next world-class, best-selling,
- # 600K application. A stick figure drawing of the human body may
- # be a good example of the form for a painting, but that does not
- # mean it should be used as the basis for the next Mona Lisa.
- #
- # We recommend that you review this program or TESample before
- # beginning a new application.
- ------------------------------------------------------------------------------*/
-
-
- #include "SysTypes.r"
- #include "Types.r"
-
- #include "Sample.h"
-
- resource 'vers' (1) {
- 0x01, 0x00, beta, 0x00,
- verUS,
- "1.1",
- "1.1, \251 Apple Computer, Inc. 1987-1993. All Rights Reserved."
- };
-
-
- /* we use an MBAR resource to conveniently load all the menus */
-
- resource 'MBAR' (rMenuBar, preload) {
- { mApple, mFile, mEdit, mObject, mOptions };
- };
-
-
- resource 'MENU' (mApple, preload) {
- mApple, textMenuProc,
- AllItems & ~MenuItem2, /* Disable dashed line, enable About and DAs */
- enabled, apple,
- {
- "About Virtual Sphere Sample…",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain
- }
- };
-
- resource 'MENU' (mFile, preload) {
- mFile, textMenuProc,
- MenuItem12, /* enable Quit only, program enables others */
- enabled, "File",
- {
- "New",
- noicon, "N", nomark, plain;
- "Open",
- noicon, "O", nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Close",
- noicon, "W", nomark, plain;
- "Save",
- noicon, "S", nomark, plain;
- "Save As…",
- noicon, nokey, nomark, plain;
- "Revert",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Page Setup…",
- noicon, nokey, nomark, plain;
- "Print…",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Quit",
- noicon, "Q", nomark, plain
- }
- };
-
- resource 'MENU' (mEdit, preload) {
- mEdit, textMenuProc,
- NoItems, /* disable everything, program does the enabling */
- enabled, "Edit",
- {
- "Undo",
- noicon, "Z", nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Cut",
- noicon, "X", nomark, plain;
- "Copy",
- noicon, "C", nomark, plain;
- "Paste",
- noicon, "V", nomark, plain;
- "Clear",
- noicon, nokey, nomark, plain
- }
- };
-
- resource 'MENU' (mObject, preload) {
- mObject, textMenuProc,
- NoItems, /* disable everything, program does the enabling */
- enabled, "Object",
- {
- "Cube",
- noicon, nokey, nomark, plain;
- "Icosahedron",
- noicon, nokey, nomark, plain;
- "House",
- noicon, nokey, nomark, plain;
- }
- };
-
-
- resource 'MENU' (mOptions, preload) {
- mOptions, textMenuProc,
- NoItems, /* disable everything, program does the enabling */
- enabled, "Options",
- {
- "Line Drawing",
- noicon, nokey, nomark, plain;
- "Flat Shading",
- noicon, nokey, nomark, plain;
- "Flat Shading with Outline",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Draw In B/W",
- noicon, nokey, nomark, plain;
- "Draw In Color",
- noicon, nokey, nomark, plain;
- "-",
- noicon, nokey, nomark, plain;
- "Backfaced Polygon Removal",
- noicon, nokey, nomark, plain;
- "Double Buffer",
- noicon, nokey, nomark, plain;
- }
- };
-
-
- /* this ALRT and DITL are used as an About screen */
-
- resource 'ALRT' (rAboutAlert, purgeable) {
- {40, 20, 160, 297},
- rAboutAlert,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, silent,
- /* [2] */
- OK, visible, silent,
- /* [3] */
- OK, visible, silent,
- /* [4] */
- OK, visible, silent
- }
- };
-
- resource 'DITL' (rAboutAlert, purgeable) {
- { /* array DITLarray: 5 elements */
- /* [1] */
- {88, 185, 108, 265},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {8, 8, 24, 214},
- StaticText {
- disabled,
- "Virtual Sphere Sample v1.1"
- },
- /* [3] */
- {32, 8, 48, 296},
- StaticText {
- disabled,
- "Copyright © Apple Computer Inc. 1993."
- },
- /* [4] */
- {56, 8, 72, 136},
- StaticText {
- disabled,
- "Brought to you by:"
- },
- /* [5] */
- {80, 24, 112, 167},
- StaticText {
- disabled,
- "Michael Chen, Human Interface Group / ATG"
- }
- }
- };
-
-
- /* this ALRT and DITL are used as an error screen */
-
- resource 'ALRT' (rUserAlert, purgeable) {
- {40, 20, 120, 260},
- rUserAlert,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, silent,
- /* [2] */
- OK, visible, silent,
- /* [3] */
- OK, visible, silent,
- /* [4] */
- OK, visible, silent
- }
- };
-
- resource 'ALRT' (130, purgeable) {
- {40, 20, 154, 260},
- 130,
- { /* array: 4 elements */
- /* [1] */
- OK, visible, silent,
- /* [2] */
- OK, visible, silent,
- /* [3] */
- OK, visible, silent,
- /* [4] */
- OK, visible, silent
- }
- };
-
- resource 'DITL' (rUserAlert, purgeable) {
- { /* array DITLarray: 3 elements */
- /* [1] */
- {50, 150, 70, 230},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {10, 60, 30, 230},
- StaticText {
- disabled,
- "Sample - Error occurred!"
- },
- /* [3] */
- {8, 8, 40, 40},
- Icon {
- disabled,
- 2
- }
- }
- };
-
- resource 'DITL' (rMessageAlert, purgeable) {
- { /* array DITLarray: 3 elements */
- /* [1] */
- {87, 150, 107, 230},
- Button {
- enabled,
- "OK"
- },
- /* [2] */
- {10, 60, 72, 230},
- StaticText {
- disabled,
- "^0"
- },
- /* [3] */
- {8, 8, 40, 40},
- Icon {
- disabled,
- 2
- }
- }
- };
-
-
- resource 'WIND' (rWindow, preload, purgeable) {
- {60, 60, 60+300, 60+300},
- noGrowDocProc, visible, noGoAway, 0x0, "Virtual Sphere"
- };
-
-
- /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
-
- resource 'SIZE' (-1) {
- dontSaveScreen,
- acceptSuspendResumeEvents,
- enableOptionSwitch,
- canBackground, /* we can background; we don't currently, but our sleep value */
- /* guarantees we don't hog the Mac while we are in the background */
- multiFinderAware, /* this says we do our own activate/deactivate; don't fake us out */
- backgroundAndForeground, /* this is definitely not a background-only application! */
- dontGetFrontClicks, /* change this is if you want "do first click" behavior like the Finder */
- ignoreChildDiedEvents, /* essentially, I'm not a debugger (sub-launching) */
- is32BitCompatible, /* this app should not be run in 32-bit address space */
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- reserved,
- kPrefSize * 1024,
- kMinSize * 1024
- };
-
-
-
- resource 'PAT#' (rDitherPatterns, "Dither Patterns") {
- { /* array PatArray: 65 elements */
- /* [1] */
- $"FFFF FFFF FFFF FFFF",
- /* [2] */
- $"FEFF FFFF FFFF FFFF",
- /* [3] */
- $"FEFF FFFF EFFF FFFF",
- /* [4] */
- $"FEFF FFFF EEFF FFFF",
- /* [5] */
- $"EEFF FFFF EEFF FFFF",
- /* [6] */
- $"EEFF FBFF EEFF FFFF",
- /* [7] */
- $"EEFF FBFF EEFF BFFF",
- /* [8] */
- $"EEFF FBFF EEFF BBFF",
- /* [9] */
- $"EEFF BBFF EEFF BBFF",
- /* [10] */
- $"EEFF BAFF EEFF BBFF",
- /* [11] */
- $"EEFF BAFF EEFF ABFF",
- /* [12] */
- $"EEFF BAFF EEFF AAFF",
- /* [13] */
- $"EEFF AAFF EEFF AAFF",
- /* [14] */
- $"EAFF AAFF EEFF AAFF",
- /* [15] */
- $"EAFF AAFF AEFF AAFF",
- /* [16] */
- $"EAFF AAFF AAFF AAFF",
- /* [17] */
- $"AAFF AAFF AAFF AAFF",
- /* [18] */
- $"AAFD AAFF AAFF AAFF",
- /* [19] */
- $"AAFD AAFF AADF AAFF",
- /* [20] */
- $"AAFD AAFF AADD AAFF",
- /* [21] */
- $"AADD AAFF AADD AAFF",
- /* [22] */
- $"AADD AAF7 AADD AAFF",
- /* [23] */
- $"AADD AAF7 AADD AA7F",
- /* [24] */
- $"AADD AAF7 AADD AA77",
- /* [25] */
- $"AADD AA77 AADD AA77",
- /* [26] */
- $"AADD AA75 AADD AA77",
- /* [27] */
- $"AADD AA75 AADD AA57",
- /* [28] */
- $"AADD AA75 AADD AA55",
- /* [29] */
- $"AADD AA55 AADD AA55",
- /* [30] */
- $"AAD5 AA55 AADD AA55",
- /* [31] */
- $"AAD5 AA55 AA5D AA55",
- /* [32] */
- $"AAD5 AA55 AA55 AA55",
- /* [33] */
- $"AA55 AA55 AA55 AA55",
- /* [34] */
- $"AA54 AA55 AA55 AA55",
- /* [35] */
- $"AA54 AA55 AA45 AA55",
- /* [36] */
- $"AA54 AA55 AA44 AA55",
- /* [37] */
- $"AA44 AA55 AA44 AA55",
- /* [38] */
- $"AA44 AA51 AA44 AA55",
- /* [39] */
- $"AA44 AA51 AA44 AA15",
- /* [40] */
- $"AA44 AA51 AA44 AA11",
- /* [41] */
- $"AA44 AA11 AA44 AA11",
- /* [42] */
- $"AA44 AA10 AA44 AA11",
- /* [43] */
- $"AA44 AA10 AA44 AA01",
- /* [44] */
- $"AA44 AA10 AA44 AA",
- /* [45] */
- $"AA44 AA00 AA44 AA",
- /* [46] */
- $"AA40 AA00 AA44 AA",
- /* [47] */
- $"AA40 AA00 AA04 AA",
- /* [48] */
- $"AA40 AA00 AA00 AA",
- /* [49] */
- $"AA00 AA00 AA00 AA",
- /* [50] */
- $"A800 AA00 AA00 AA",
- /* [51] */
- $"A800 AA00 8A00 AA",
- /* [52] */
- $"A800 AA00 8800 AA",
- /* [53] */
- $"8800 AA00 8800 AA",
- /* [54] */
- $"8800 A200 8800 AA",
- /* [55] */
- $"8800 A200 8800 2A",
- /* [56] */
- $"8800 A200 8800 22",
- /* [57] */
- $"8800 2200 8800 22",
- /* [58] */
- $"8800 2000 8800 22",
- /* [59] */
- $"8800 2000 8800 02",
- /* [60] */
- $"8800 2000 88",
- /* [61] */
- $"8800 0000 88",
- /* [62] */
- $"8000 0000 88",
- /* [63] */
- $"8000 0000 08",
- /* [64] */
- $"80",
- /* [65] */
- $""
- }
- };
-